export default (className,type) => {
  return new Promise((resolve,reject) => {
      uni.getSystemInfo({
      　　success(res) { 
          if(!className) {
              resolve(res)
          }else {
      　　    let dom = uni.createSelectorQuery().select(className);
  　　　  	  dom.boundingClientRect((data) => { 
                  switch(type) {
                      case "width":
                          resolve(data.width)
                      break;
                      case "height":
                          resolve(data.height)
                      break;
                      case "top":
                          resolve(data.top)
                      break;
                      case "left":
                          resolve(data.left)
                      break;
                      case "right":
                          resolve(data.right)
                      break;
                      case "bottom":
                          resolve(data.bottom)
                      break;
                      default:
                          let obj = {
                              window_info: res,
                              dom_info: data,
                          }
                          resolve(obj)
                  }
      　　        }).exec()
              }
          }
      });
  })
}